package com.aiobc.business.appInfo.service.impl;

import java.util.List;
import java.util.Objects;

import com.aiobc.business.appInfo.domain.AppApproval;
import com.aiobc.business.appInfo.mapper.AppApprovalMapper;
import com.aiobc.business.appInfo.mapper.AppInfoMapper;
import com.aiobc.business.appInfo.service.IAppInfoService;
import com.aiobc.common.core.constant.Constants;
import com.aiobc.common.core.constant.UserConstants;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.aiobc.business.appInfo.domain.AppInfo;

/**
 * APP申请信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-10-20
 */
@Service
public class AppInfoServiceImpl extends ServiceImpl<AppInfoMapper, AppInfo> implements IAppInfoService
{
    @Autowired
    private AppInfoMapper appInfoMapper;

    /**
     * 查询APP申请信息
     * 
     * @param dataId APP申请信息主键
     * @return APP申请信息
     */
    @Override
    public AppInfo selectAppInfoByDataId(String dataId)
    {
        //todo 获取评价信息并封装到返回数据
        return appInfoMapper.selectAppInfoByDataId(dataId);
    }

    /**
     * 查询APP申请信息列表
     * 
     * @param appInf APP申请信息
     * @param sort
     * @return APP申请信息
     */
    @Override
    public List<AppInfo> selectAppInfoList(AppInfo appInf, Integer sort)
    {
        //不筛选状态则默认查询上线的应用
        if (appInf.getAppStatus()==null || Objects.equals(appInf.getAppStatus(), Constants.EMPTY_STRING)){
            appInf.setAppStatus(UserConstants.NORMAL);
        }
        //todo 添加数据排序逻辑(前台应用首页展示排序)
        return appInfoMapper.selectAppInfoList(appInf,sort);
    }

    /**
     * 修改APP申请信息
     * 
     * @param appInf APP申请信息
     * @return 结果
     */
    @Override
    public int updateAppInfo(AppInfo appInf)
    {
        return appInfoMapper.updateAppInfo(appInf);
    }

    /**
     * 批量删除APP申请信息
     * 
     * @param dataIds 需要删除的APP申请信息主键
     * @return 结果
     */
    @Override
    public int deleteAppInfoByDataIds(String[] dataIds)
    {
        return appInfoMapper.deleteAppInfoByDataIds(dataIds);
    }

    /**
     * 删除APP申请信息信息
     * 
     * @param dataId APP申请信息主键
     * @return 结果
     */
    @Override
    public int deleteAppInfoByDataId(String dataId)
    {
        return appInfoMapper.deleteAppInfoByDataId(dataId);
    }
}
